Skip to content

review(stark): address PR #735 review — coverage, dead code, cleanups#740

Merged
diegokingston merged 1 commit into
perf/commitment-row-pairfrom
review/commitment-row-pair-fixes
Jun 29, 2026
Merged

review(stark): address PR #735 review — coverage, dead code, cleanups#740
diegokingston merged 1 commit into
perf/commitment-row-pairfrom
review/commitment-row-pair-fixes

Conversation

@MauroToscano

@MauroToscano MauroToscano commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #735 (perf/commitment-row-pair) addressing findings from an adversarial review. Targets the #735 branch so the fixes land with it. The intentional proof-format break (proof_sym removal / leaf-count change) is left as-is — that's by design.

Soundness of the row-pair change itself was verified clean (CPU commit ↔ GPU kernels ↔ verifier are byte-consistent; Fiat-Shamir transcript order preserved). These changes harden coverage and remove leftovers. New tests live in their own files under crypto/stark/src/tests/, matching the crate's test layout.

Test coverage (MEDIUM findings)

  • tests/commitment_tests.rs (new) — direct unit tests pinning the row-pair leaf layout (R=1 and R=2) against an independent reference, wrapper agreement, commit-root consistency, and empty-input short-circuit. The layout was previously only covered transitively via full prove→verify; the GPU parity tests compare against an inline reimpl, not this module.
  • tests/row_pair_opening_tests.rs (new) — two negative tests for the row-pair verify_opening_pair: a tampered symmetric trace evaluation and a corrupted Merkle authentication path must both be rejected. Removing proof_sym deleted the old "symmetric opening mismatch" rejection class; an impl that ignored evaluations_sym or the auth path would otherwise pass every existing test. (Reuses the now pub(crate) make_valid_simple_proof helper.)
  • cuda_path_integration.rs — restore assert!(gpu_comp_poly_tree_calls() > 0). try_build_comp_poly_tree_gpu is dispatched unconditionally (round 2, after the parts-count branch), so it fires for the common number_of_parts == 2 (degree-3) case — it was not obsolete. The genuinely-dead parts-LDE assertion stays dropped. (Note: this test is cuda-gated, so it's only exercised on a GPU runner.)

Cleanups (LOW)

  • Delete dead fn commit_plain (zero callers; main/aux paths inline commit_rows_bit_reversed + spill_tree, which are row-major and incompatible with its column-major signature — the advertised dedup never landed).
  • Delete orphaned pub fn columns2rows (all callers removed by refactor(stark): unify & clean up the commitment layer #735).
  • Add ProvingError::Fft and map FFTError to it instead of WrongParameter (internal FFT failure isn't a caller-supplied-parameter error; message preserved).
  • Fix stale profiler label commit_composition_polycommit_bit_reversed.
  • Drop the rot-prone // = 2 comment on the local ROWS_PER_LEAF alias.

Deliberately not changed

  • The debug_assert! precondition checks in commitment.rs stay debug_assert!. This is prover-side: a violated invariant yields a proof the verifier rejects, not a soundness break, so it's not worth a release-mode panic. The debug build still catches it in dev/test.

Verification

  • cargo test -p stark — passes (4 commitment tests + 2 row-pair opening tests + existing suite).
  • make lint — clean across all three combos (default / --no-default-features --features debug-checks / disk-spill).
  • CUDA paths reviewed statically (no nvcc on the dev host); the cuda_path_integration assertion is restored by inspection.

Not addressed (out of scope per request)

@MauroToscano MauroToscano force-pushed the review/commitment-row-pair-fixes branch from 3dba2df to f6877ca Compare June 29, 2026 20:42
Follow-up to the row-pair commitment PR. Excludes the intentional
proof-format break (proof_sym removal / leaf-count change), which is
by design.

Test coverage (in their own files under crypto/stark/src/tests/, per the
crate's test structure):
- tests/commitment_tests.rs: direct unit tests pinning the row-pair leaf
  layout (R=1 and R=2) against an independent reference, wrapper
  agreement, commit-root consistency, and empty-input short-circuit.
  Previously the leaf layout was only covered transitively via full
  prove->verify, and GPU parity tests compared against an inline reimpl
  rather than this module.
- tests/row_pair_opening_tests.rs: two negative tests for the row-pair
  verify_opening_pair — a tampered symmetric trace evaluation and a
  corrupted Merkle authentication path must both be rejected. Removing
  proof_sym deleted the old "symmetric opening mismatch" rejection class;
  these restore it (an impl ignoring evaluations_sym / the auth path
  would otherwise pass every existing test). Reuses the now pub(crate)
  make_valid_simple_proof helper.
- cuda_path_integration.rs: restore assert!(gpu_comp_poly_tree_calls() > 0).
  try_build_comp_poly_tree_gpu is dispatched unconditionally (round 2,
  after the parts-count branch), so it fires for the common
  number_of_parts == 2 (degree-3) case — it was NOT obsolete. Keep the
  genuinely-dead parts-LDE assertion dropped.

Cleanups:
- Delete dead fn commit_plain (zero callers; main/aux commit inline
  commit_rows_bit_reversed + spill_tree, which are row-major and
  incompatible with its column-major signature — the dedup never landed).
- Delete orphaned pub fn columns2rows (all callers removed by #735).
- Add ProvingError::Fft and map FFTError to it instead of WrongParameter
  (internal FFT failure is not a caller-supplied-parameter error).
- Fix stale profiler label commit_composition_poly -> commit_bit_reversed.
- Drop the rot-prone "// = 2" comment on the local ROWS_PER_LEAF alias.
@MauroToscano MauroToscano force-pushed the review/commitment-row-pair-fixes branch from f6877ca to 1abb9d3 Compare June 29, 2026 20:48
@diegokingston diegokingston merged commit 275eadd into perf/commitment-row-pair Jun 29, 2026
12 checks passed
@diegokingston diegokingston deleted the review/commitment-row-pair-fixes branch June 29, 2026 21:11
MauroToscano added a commit that referenced this pull request Jun 29, 2026
#744)

Two items that landed too late for #740:

- Move the shared make_valid_simple_proof helper out of small_trace_tests.rs
  into tests/trace_test_helpers.rs, where the crate keeps shared test
  helpers (matching how prover_tests sources get_trace_evaluations).
  row_pair_opening_tests.rs and small_trace_tests.rs now both import it
  from there instead of one test file reaching sideways into another.
- Delete AGENTS.md (added by #735).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants